package cn.edu.scau.cmi.linhuanrui.composite.safe;

import java.util.HashSet;
import java.util.Set;

import cn.edu.scau.cmi.linhuanrui.composite.consistent.ConsitentOrganization;

public class SafeTeam extends SafeOrganization {
	private Set<SafeOrganization> children = new HashSet<SafeOrganization>();

	public SafeTeam(String name) {
		super(name);
	}

	public void addChild(SafeOrganization child) {
		this.children.add(child);
	}

	public void deleteChild(SafeOrganization child) {
		this.children.remove(child);
	}

	public Set<SafeOrganization> getChildren() {
		return children;
	}

	public void setChildren(Set<SafeOrganization> children) {
		this.children = children;
	}

	public void show(int level) {
		if (level == 0) {
			System.out.println(name);
		} else {
			for (int i = 0; i < level; i++) {
				System.out.print("\t");
			}
			System.out.println(name);
		}
		for (SafeOrganization child : children) {
			child.show(level + 1);
		}
	}

}
